package com.lyf.scm.job.remote.facade;

import com.lyf.scm.common.enums.ResponseMsg;
import com.lyf.scm.job.remote.BigDataRedisCacheRemoteService;
import com.rome.arch.core.clientobject.Response;
import com.rome.arch.core.exception.RomeException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 大数据redis缓存job
 *
 * @author wangchlei
 * @date 2020/09/14
 */
@Slf4j
@Component
public class BigDataRedisCacheFacade {
    @Resource
    private BigDataRedisCacheRemoteService bigDataRedisCacheRemoteService;

    /**
     * 处理job
     *
     * @param
     * @return void
     **/
    public void handleRedisCache() {
        Response response = bigDataRedisCacheRemoteService.handleRedisCache();
        if (!ResponseMsg.SUCCESS.getCode().equals(response.getCode())) {
            log.error("================== 执行大数据redis缓存job 失败 ==================");
            throw new RomeException(response.getCode(), response.getMsg());
        }
        log.info("================== 执行大数据redis缓存job 成功 ==================");
    }
}
